package com.airlines.basedata.controller;


import javax.naming.NoPermissionException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.airlines.basedata.domain.Tbasdic;
import com.airlines.basedata.service.DataDectionarySercice;
import com.airlines.common.Page;

/**
 * 数据字典controller
 * @author hjj
 *2018年9月18日
 */
@Controller
@RequestMapping("/dataDectionary")
public class DataDectionaryController {
	private static final String PREFIX = "/basedata";
	 @Autowired
	    private DataDectionarySercice dataDectionaryService;
	    /**
	     * 进入页面
	     * @return
	     */
	    @RequestMapping(value = "", method={ RequestMethod.GET})
	   // @RequiresPermissions("basicinfo:overnightAirport:list")
	    String toAirportPage(Model model,String moduleFlag) throws NoPermissionException {
	        model.addAttribute("moduleFlag",moduleFlag);
	        return PREFIX + "/dataDectionaryList";
	    }
	 /**
	   * 模糊多条件查询列表
	   * 参数:page，tbasdic对象,limit
	   * @return  page
	   */
	    @RequestMapping(value = "/list", method={ RequestMethod.GET})
	    public Page toAirportList(Tbasdic tbasdic, String offset, String limit){
	    	  Page page = new Page();
	          page.setPageNumber((Integer.valueOf(offset) / (Integer.valueOf(limit))));
	          page.setPageSize(Integer.valueOf(limit));
	          page = dataDectionaryService.list(tbasdic, page);
	    	//List<Tbasdic> list=dataDectionaryService.queryList();
//	    	if(list.size()<1||list==null){
//	    		System.out.println("空的");
//	    	}else
//	    	{
//	    		for(Tbasdic bs:list){
//	    			System.out.println("名称为:"+bs.getcEname());
//	    		}
//	    	}
	        return page;
	    }
}
